package com.obtk.service.impl;

import com.obtk.mapper.ProStorageMapper;
import com.obtk.modelSGW.ProStorage;
import com.obtk.service.ProStorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 功能说明
 *
 * @author Mr.Sun
 * @date 2023-04-01 17:14:45
 */
@Service
public class ProStorageServiceImpl implements ProStorageService {
    @Autowired
    ProStorageMapper proStorageMapper;

    @Override
    public List<ProStorage> selectProStorage(ProStorage proStorage) {
        return proStorageMapper.selectProStorage(proStorage);
    }

    @Override
    public ProStorage selectByStkProdName(String stkProdName) {
        return proStorageMapper.selectByStkProdName(stkProdName);
    }

    @Override
    public int register(ProStorage proStorage) {

        proStorage.setStkStatus(1);
        int insert = proStorageMapper.insert(proStorage);
        return insert;
    }

    @Override
    public ProStorage selectByStkProdId(String stkId) {
        return proStorageMapper.selectByStkProdId(stkId);
    }

    @Override
    public int updateByStkProdId(ProStorage proStorage) {
        return proStorageMapper.updateByStkProdId(proStorage);
    }

    //根据编号更改状态sgw
    @Override
    public int updateByStkProdCode(ProStorage proStorage) {
        return proStorageMapper.updateByStkProdCode(proStorage);
    }

    @Override
    public int updateStatusBatch(List<String> stkProdIds, Integer stkStatus) {
        Map<String, Object> params = new HashMap<String, Object>(2);
        params.put("stkProdIds", stkProdIds);
        params.put("stkProdStatus", stkStatus);
        return proStorageMapper.updateStatusBatch(params);
    }

    @Override
    public int updateProStorage(ProStorage proStorage) {
        return proStorageMapper.updateProStorage(proStorage);
    }
}
